package com.jd.job.keeper;


import com.jd.jobkeeper.client.Handler;
import com.jd.jobkeeper.client.TaskContext;

import java.util.concurrent.TimeUnit;

public class BizTaskHandler implements Handler {

    @Override
    public String name() {
        return ID_TAG + "com.jd.pjob";
    }

    @Override
    public void handler(TaskContext context) throws Exception {
        int loop = 20;
        while (!context.isInterrupted() && loop > 0) {
            loop--;
            TimeUnit.SECONDS.sleep(1);
            System.out.println(context.toString());
        }
        System.out.println("Finished!");
    }
}
